package task

import (
	"apedge/pkg/common"

	"github.com/apulis/go-business/pkg/jobscheduler"
)

// job-scheduler 状态对应的任务状态
var Job2TaskStatus = map[jobscheduler.JobStatus]string{
	jobscheduler.JOB_STATUS_UNAPPROVE:   common.TASK_STATUS_SCHEDULING,
	jobscheduler.JOB_STATUS_QUEUEING:    common.TASK_STATUS_SCHEDULING,
	jobscheduler.JOB_STATUS_SCHEDULING:  common.TASK_STATUS_SCHEDULING,
	jobscheduler.JOB_STATUS_RUNNING:     common.TASK_STATUS_RUNNING,
	jobscheduler.JOB_STATUS_FINISH:      common.TASK_STATUS_ERROR,
	jobscheduler.JOB_STATUS_ERROR:       common.TASK_STATUS_ERROR,
	jobscheduler.JOB_STATUS_UNKOWN:      common.TASK_STATUS_ERROR,
	jobscheduler.JOB_STATUS_TERMINATING: common.TASK_STATUS_TERMINATING,
	jobscheduler.JOB_STATUS_TERMINATED:  common.TASK_STATUS_STOP,
}

// 设备实际名字对应在k8s的tag computeType
var DeviceTagInK8s = map[string]string{
	"npu.huawei.com/NPU": "huawei_npu",
	"nvidia.com/gpu":     "nvidia_gpu",
}

const (
	NODE_READY                         = "Ready"
	NODE_NOT_READY                     = "NotReady"
	MSG_TYPE_NODE                      = "node"
	MSG_TYPE_NODE_DEVICE               = "nodeDevice"
	MSG_TYPE_NODE_DEVICE_ACTION_UPDATE = "update"
)

var NodeActionToStatus = map[string]string{
	NODE_READY:     common.NODE_STATUS_ONLINE,
	NODE_NOT_READY: common.NODE_STATUS_OFFLINE,
}
